<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/dndTemplate.xhtml">


	<ui:define name="main">
			<table border="1" width="100%">
				<tr>
					
					<td colspan="2">
					<h:form >
						<p:growl id="messages" showDetail="true"/>  
						Name:<p:inputText
								value="#{adminActionsBean.searchActionName}" id="searchActionName" />
							Description:<p:inputText value="#{adminActionsBean.searchActionDesc}"
								id="searchActionDesc" /> <p:commandButton value="Search"
								action="#{adminActionsBean.searchAction(adminActionsBean.actions,null)}" update=":actions">
							</p:commandButton>
					</h:form>
					</td>
				</tr>

				<tr>
					<td width="300" height="500" valign="top">
						
							<p:dataList
								value="#{adminActionsBean.actions}" var="action" id="actions"
								type="definition" paginator="true" rows="15">

								<h:form>
									<p:growl id="messages" showDetail="true" />
		
									<p:commandButton icon="ui-icon-search" update=":actionForm" title="View Detail" action="#{myCardsBean.selectAction(action)}" />
									<p:graphicImage value="#{action.pictureURL}&amp;userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}" width="40" height="50" />
										#{action.name}
								</h:form>

					</p:dataList>
						
						</td>
					<td valign="top">
						<table>
							<tr>
								<td valign="top">
								<p:growl id="messages" showDetail="true"/>  
								<h:form  id="actionForm" rendered="#{myCardsBean.selectedAction!=null}">
						
								Name:<p:inputText value="#{myCardsBean.selectedAction.name}" />
								<br />
								Picture: <p:inputText value="#{myCardsBean.selectedAction.pictureURL}" />
								<p:graphicImage value="#{myCardsBean.selectedAction.pictureURL}&amp;userName=#{myCardsBean.userName}&amp;sessionID=#{myCardsBean.sessionID}" width="240"
												height="300" />
								<br />
								Description:<p:inputText value="#{myCardsBean.selectedAction.description}" />
								<br />
								<p:commandButton  value="Save" action="#{adminActionsBean.searchAction(adminActionsBean.actions,null)}" update=":actions :messages :actionForm" >
									<f:actionListener binding="#{myCardsBean.updateAction()}"/>
								</p:commandButton>
								<p:commandButton  value="Add"  action="#{adminActionsBean.searchAction(adminActionsBean.actions,null)}" update=":actions :messages :actionForm">
									<f:actionListener binding="#{myCardsBean.createAction()}"/>
								</p:commandButton>
								<p:commandButton  value="Remove"  action="#{adminActionsBean.searchAction(adminActionsBean.actions,null)}" update=":actions :messages :actionForm">
									<f:actionListener binding="#{myCardsBean.deleteAction()}"/>
								</p:commandButton>
								</h:form>
								<h:form enctype="multipart/form-data">
											<p:messages showDetail="true"/>  
											<p:fileUpload value="#{myCardsBean.uploadedFile}" mode="simple" />
											<p:commandButton value="submit" ajax="false"  action="#{adminActionsBean.searchAction(adminActionsBean.actions,null)}" update=":actions :actionForm" >
												<f:actionListener binding="#{myCardsBean.uploadCard(myCardsBean.selectedAction.id)}" />
											</p:commandButton>
											
								</h:form>
								
								</td>
								<td  height="300" valign="top">
								</td>

							</tr>


						

						</table>
					</td>
				</tr>
			</table>



	</ui:define>

</ui:composition>

</html>
